package com.api.department.unfollow;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IDepartmentApiService;
import com.zyncro.api.exceptions.ZyncroApiException;
import com.zyncro.api.model.ObjectResultApi;

@ContextConfiguration(locations = "classpath:/department/department-members.xml")
public class Unfollow extends AbstractApiTest {

	@Value("#{department_toFollow[follower].appId}")
	private String userUrn;

	@Value("#{department_toFollow[follower].password}")
	private String userPassword;

	@Value("#{department_toFollow.urn}")
	private String iddepartment;

	@BeforeClass
	protected void loginUser() throws Exception {

		getApi().login(userUrn, userPassword);
	}

	@Test
	public void test() throws ZyncroApiException {

		ObjectResultApi<String> result = getApi().getService(IDepartmentApiService.class).unfollowDepartment(iddepartment);

		Assert.assertNotNull(result);
	}

	@AfterClass
	public void restoreState() throws ZyncroApiException {
		getApi().getService(IDepartmentApiService.class).unfollowDepartment(iddepartment);

	}
}
